home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Libraries / TransSkel / Demos / C Demos / Button / Main.c < prev   
Encoding:
C/C++ Source or Header  |  1994-02-21  |  1.6 KB  |  82 lines  |  [TEXT/KAHL]

  1. /*
  2.  * Button - Demonstration of TransSkel button outlining.  Accompanies discussion
  3.  * in TransSkel Programmer's Note 10.
  4.  *
  5.  * Dialog 1 demonstrates how to install an outliner for the button that's
  6.  * indicated as the default in the dialog template, and how to make the
  7.  * outline change state when the button does.
  8.  *
  9.  * Dialog 2 demonstrates how to install an outliner when the button to
  10.  * be outlined isn't necessarily the default, and how to change the button
  11.  * with which the outline is associated.
  12.  *
  13.  * The document window demonstrates simple use of SkelDrawButtonOutline()
  14.  * in a document window.
  15.  *
  16.  * 11 Jan 94 Paul DuBois
  17.  *
  18.  * 11 Jan 94 Release 1.00
  19.  * 21 Feb 94
  20.  * - Updated for TransSkel 3.11.
  21.  */
  22.  
  23. # include    "TransSkel.h"
  24.  
  25. # include    "Button.h"
  26.  
  27.  
  28. /*
  29.  * Handle selection of "About Button..." item from Apple menu
  30.  */
  31.  
  32. static pascal void
  33. DoAppleMenu (short item)
  34. {
  35.     (void) SkelAlert (aboutAlrtRes, SkelDlogFilter (nil, true),
  36.                                             skelPositionOnParentDevice);
  37.     SkelRmveDlogFilter ();
  38. }
  39. /*
  40.  * Process selection from File menu.
  41. */
  42.  
  43. static pascal void
  44. DoFileMenu (short item)
  45. {
  46.     switch (item)
  47.     {
  48.     case doDialog1:
  49.         DoDialog1 ();
  50.         break;
  51.     case doDialog2:
  52.         DoDialog2 ();
  53.         break;
  54.     case doDialog3:
  55.         DoDialog3 ();
  56.         break;
  57.     case quitApp:
  58.         SkelStopEventLoop ();
  59.         break;
  60.     }
  61. }
  62.  
  63.  
  64.  
  65. int
  66. main (void)
  67. {
  68. MenuHandle    m;
  69.  
  70.     SkelInit ((SkelInitParamsPtr) nil);    /* initialize */
  71.  
  72.     SkelApple ("\pAbout Button\311", DoAppleMenu);
  73.     m = GetMenu (fileMenuRes);
  74.     (void) SkelMenu (m, DoFileMenu, nil, false, true);
  75.  
  76.     SetupDocument ();
  77.  
  78.     SkelEventLoop ();
  79.  
  80.     SkelCleanup ();                        /* clean up */
  81. }
  82.